home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1997 January: Mac OS SDK / Dev.CD Jan 97 SDK1.toast / Development Kits (Disc 1) / AppleShare API / PowerPC AppleShare API / PPC UGLibrary / UGLibraryGlue.h < prev   
Encoding:
C/C++ Source or Header  |  1995-04-12  |  2.5 KB  |  107 lines  |  [TEXT/MPS ]

  1. /*
  2. **    Apple Macintosh Developer Technical Support
  3. **
  4. **    Glue to call UGLibrary in a code resource from a PPC application
  5. **
  6. **    by Jim Luther, Apple Developer Technical Support
  7. **
  8. **    File:    UGLibraryGlue.h
  9. **
  10. **    Copyright © 1995 Apple Computer, Inc.
  11. **    All rights reserved.
  12. **
  13. **    You may incorporate this sample code into your applications without
  14. **    restriction, though the sample code has been provided "AS IS" and the
  15. **    responsibility for its operation is 100% yours.  However, what you are
  16. **    not permitted to do is to redistribute the source as "DSC Sample Code"
  17. **    after having made changes. If you're going to re-distribute the source,
  18. **    we require that you make it clear in the source that the code was
  19. **    descended from Apple Sample Code, but that you've made changes.
  20. */
  21.  
  22. #include <Types.h>
  23. #include <MixedMode.h>
  24. #include <OSUtils.h>
  25.  
  26. #include "UGLibrary.h"
  27.  
  28. /*
  29. **    The UGLibrary resource type and ID. These must be the same as those in
  30. **    the UGLibraryGlue.rsrc.make file.
  31. */
  32. enum
  33. {
  34.     kUGLibraryResType    = 'CUST',
  35.     kUGLibraryResID        = 128
  36. };
  37.  
  38.  
  39. /*
  40. **    The function calling convention for all UGLibrary routines.
  41. */
  42. typedef    pascal OSErr (*UGProcPtr)(UserGroupPBPtr thePB, Boolean async);
  43.  
  44. #if GENERATINGCFM
  45. typedef UniversalProcPtr UGProcUPP;
  46. #else
  47. typedef UGProcPtr UGProcUPP;
  48. #endif
  49.  
  50. #if GENERATINGCFM
  51. enum
  52. {
  53.     uppUGProcInfo = kPascalStackBased
  54.          | RESULT_SIZE(SIZE_CODE(sizeof(OSErr)))
  55.          | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(UserGroupPBPtr)))
  56.          | STACK_ROUTINE_PARAMETER(2, SIZE_CODE(sizeof(Boolean)))
  57. };
  58. #define CallUGProc(userRoutine, thePB, async)        \
  59.         CallUniversalProc((UniversalProcPtr)(userRoutine), uppUGProcInfo, (thePB), (async))
  60. #else
  61. #define CallUGProc(userRoutine, thePB, async)        \
  62.         (*(userRoutine))((thePB), (async))
  63. #endif
  64.  
  65. #if GENERATINGPOWERPC
  66. #pragma options align=mac68k
  67. #endif
  68.  
  69. /*
  70. **    Shared struct describing UGLibrary entry points.
  71. */
  72. struct UGEntryPoints
  73. {
  74.     UGProcUPP    UGOpenFile;
  75.     UGProcUPP    UGCloseFile;
  76.     UGProcUPP    UGCreateFile;
  77.  
  78.     UGProcUPP    UGNewUser;
  79.     UGProcUPP    UGDeleteUser;
  80.     UGProcUPP    UGRenameUser;
  81.     UGProcUPP    UGGetUserInfo;
  82.     UGProcUPP    UGSetUserInfo;
  83.     UGProcUPP    UGAuthenticateUser;
  84.  
  85.     UGProcUPP    UGNewGroup;
  86.     UGProcUPP    UGDeleteGroup;
  87.     UGProcUPP    UGRenameGroup;
  88.     UGProcUPP    UGGetGroupInfo;
  89.  
  90.     UGProcUPP    UGAssignUserToGroup;
  91.     UGProcUPP    UGDeleteUserFromGroup;
  92.  
  93.     UGProcUPP    UGGetULInfo;
  94.     UGProcUPP    UGSetULInfo;
  95. };
  96. typedef struct UGEntryPoints UGEntryPoints;
  97.  
  98. #if GENERATINGPOWERPC
  99. #pragma options align=reset
  100. #endif
  101.  
  102. enum
  103. {
  104.     uppMainEntryProcInfo = kCStackBased
  105.         | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(UGEntryPoints *)))
  106. };
  107.